<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/pintuer.css">
<link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/admin.css">
<script src="${pageContext.request.contextPath}/static/js/jquery.js"></script>
<script src="${pageContext.request.contextPath}/static/js/pintuer.js"></script>
<script type="text/javascript" src="../static/plugin/zTree_v3/js/jquery-1.4.4.min.js"></script>
<link rel="stylesheet" type="text/css" href="../static/plugin/zTree_v3/css/zTreeStyle/zTreeStyle.css">
<script type="text/javascript" src="../static/plugin/zTree_v3/js/jquery.ztree.all.min.js"></script>


<script type="text/javascript">
		$(function(){
			$("#areaContry").change(function(){
			 	var url = "${pageContext.request.contextPath}/sys/area.do?method=findTownInfoByCode";
			    var areacode = $("#areaContry").find("option:selected").val();
			    
			    $("#areaTown option:not(:first)").remove();
			    $("#areaVillage option:not(:first)").remove();
			    $("#areaGroup option:not(:first)").remove();
			    $("#familyAddress").val("");
			    $.post(url,{"areacode":areacode},function(data){
					for(var i = 0; i < data.length; i++){
						$("#areaTown").append("<option  value='"+data[i].areaCode+"'>"+data[i].areaName+"</option>");
					}
				},"json");
			    
			}); 
		});
	$(function(){
			$("#areaTown").change(function(){
			      var url = "${pageContext.request.contextPath}/sys/area.do?method=findVillageInfoByCode";
			      var areacode = $("#areaTown").find("option:selected").val();
			      $("#areaVillage option:not(:first)").remove();
			      $("#areaGroup option:not(:first)").remove();
			      $("#familyAddress").val("");
			      $.post(url,{"areacode":areacode},function(data){
				    for(var i = 0; i < data.length; i++){
			           $("#areaVillage").append("<option  value='"+data[i].areaCode+"'>"+data[i].areaName+"</option>");
					}
				},"json");
			});
		});
	$(function(){
		$("#areaVillage").change(function(){
		      var url = "${pageContext.request.contextPath}/sys/area.do?method=findGroupInfoByCode";
		      var areacode = $("#areaVillage").find("option:selected").val();
		      $("#areaGroup option:not(:first)").remove();
		      $("#familyAddress").val("");
		      $.post(url,{"areacode":areacode},function(data){
			    for(var i = 0; i < data.length; i++){
		           $("#areaGroup").append("<option  value='"+data[i].areaCode+"'>"+data[i].areaName+"</option>");
				}
			},"json");
		});
	});
	
	function cascade(){
		var contry=$("#areaContry option:selected").text();//获取当前选择项.
		var areaTown=$("#areaTown option:selected").text();//获取当前选择项.
		var areaVillage=$("#areaVillage option:selected").text();//获取当前选择项.
		var areaGroup=$("#areaGroup option:selected").text();//获取当前选择项.
		
		//获取当前选择项的文本.
		/* var contry=$("#areaContry").find("option:selected").attr("data");
		var town=$("#areaTown").find("option:selected").text();;
		var village=$("#areaVillage").find("option:selected").text();
		var group=$("#areaGroup").find("option:selected").text();
		$("#workUnit").val(town+village+group); */
		$("#familyAddress").val(contry+areaTown+areaVillage+areaGroup);
		
	}
	</script> 
</head>
<body>

<div class="panel admin-panel">

  <div class="panel-head" id="add"><strong><span class="icon-pencil-square-o"></span>添加参合农民家庭档案</strong></div>
  
  <div class="body-content">
   
    <form method="post" class="form-x" action="${pageContext.request.contextPath}/sys/family.do?method=addFamilyAndHolder&tgId=${tgId}&pageNum=1">  
    	<!-- 县级 -->
      <div class="form-group">
        <div class="label">
          <label></label>
        </div>
        <div class="field">
         	<select id="areaContry" name="areaContry" class="input w50" data-validate="required:请选择县">
            <option value="">请选择所在县</option>
           	<c:forEach items="${requestScope.contryAreas }" var="area">
           	<option value="${area.areaCode}">${area.areaName}</option>
           	</c:forEach>
          	</select>
          	
          <div class="tips"></div>
        </div>
      </div>
      <!-- 镇级 -->
      <div class="form-group">
        <div class="label">
          <label></label>
        </div>
        <div class="field">
         	<select id="areaTown" name="areaTown" class="input w50"  data-validate="required:请选择乡镇">
            <option value="">请选择所在乡镇</option>
          	</select>
          <div class="tips"></div>
        </div>
      </div>
      <!-- 村级 -->
      <div class="form-group">
        <div class="label">
          <label></label>
        </div>
        <div class="field">
         	<select id="areaVillage" name="areaVillage" class="input w50" data-validate="required:请选择村">
            <option value="">请选择所在村</option>
            
          	</select>
          <div class="tips"></div>
        </div>
      </div>
      <!-- 组级 -->
      <div class="form-group">
        <div class="label">
          <label></label>
        </div>
        <div class="field">
         	<select  id="areaGroup" name="groupArea" class="input w50" data-validate="required:请选择组" onblur="cascade();">
            <option value="">请选择所在组</option>
          
          	</select>
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>户属性</label>
        </div>
        
        <div class="field">
        	<select name="familyProperty" class="input w50" >
        		<option value="1">一般户</option> 
        		<option value="2">军烈户</option> 
        		<option value="3">低保户</option> 
        	</select>
        
     
          <div class="tips"></div>
        </div>
      </div>
       <div class="form-group">
        <div class="label">
          <label>户主姓名</label>
        </div>
        
        <div class="field">
          <input type="text"  class="input w50" value="" name="familyHolder" data-validate="required:请输入户主姓名" />
          <div class="tips"></div>
        </div>
      </div>
 
       <div class="form-group">
        <div class="label">
          <label>家庭住址</label>
        </div>
        
        <div class="field">
          <input type="text" id="familyAddress"class="input w50" value="" name="familyAddress" data-validate="required:请输入家庭住址" />
          <div class="tips"></div>
        </div>
      </div>

   
      
      <!-- 户主信息 -->
      <div class="panel-head" id="add"><strong><span class="icon-pencil-square-o"></span>添加户主信息</strong></div>
      <div class="body-content">
      
        
      
      <input type="hidden"  class="input w50" value="01" name="familyInCode"  />
 
    
      <input type="hidden" name="holderRelation" value="户主" />
       <div class="form-group">
        <div class="label">
          <label>身份证号</label>
        </div>
        
        <div class="field">
          <input type="text" class="input w50" value="" name="idcardNumber" data-validate="required:请输入身份证号" />
          <div class="tips"></div>
        </div>
      </div>
       <div class="form-group">
        <div class="label">
          <label>性别</label>
        </div>
        
        <div class="field">
        	<select name="Sex"class="input w50">
        	<option value="1">男</option> 
        	<option value="2">女</option> 
        	</select>
          	
          <div class="tips">
          </div>
        </div>
      </div>
       <div class="form-group">
        <div class="label">
          <label>出生日期</label>
        </div>
        
        <div class="field">
          <input type="date" class="input w50" value="" name="Birthday" data-validate="required:请输入出生日期" />
          <div class="tips"></div>
        </div>
      </div>
       <div class="form-group">
        <div class="label">
          <label>民族</label>
        </div>
        
        <div class="field">
         <select name="Nation" class="input w50">
        		<option value="汉族">汉族</option> 
        		<option value="苗族">苗族</option>
        		<option value="壮族">壮族</option>
        		<option value="水族">水族</option>
        		<option value="高山族">高山族</option>
        	</select>
         
          <div class="tips"></div>
        </div>
      </div>
       <div class="form-group">
        <div class="label">
          <label>健康状况</label>
        </div>
        
        <div class="field">
         <select name="Health" class="input w50">
        		<option value="1">健康</option> 
        		<option value="2">不健康</option> 
        	</select>
         
          <div class="tips"></div>
        </div>
      </div>
       <div class="form-group">
        <div class="label">
          <label>文化程度</label>
        </div>
        
        <div class="field">
        <select name="cultrueDegree" class="input w50">
        		<option value="1">文盲</option>
        		<option value="2">小学</option> 
        		<option value="3">初中</option> 
        		<option value="4">高中</option>
        		<option value="5">大学</option>
        		<option value="6">其他</option>
        	</select>
        
        
          <div class="tips"></div>
        </div>
      </div>
       <div class="form-group">
        <div class="label">
          <label>人员属性</label>
        </div>
        
        <div class="field">
        <select name="personProperty" class="input w50">
        		<option value="1">一般人</option> 
        		<option value="2">变异人</option> 
        	</select>
          <div class="tips"></div>
        </div>
      </div>
       <div class="form-group">
        <div class="label">
          <label>是否农业户口</label>
        </div>
        
        <div class="field">
        	<select name="isContryside" class="input w50">
        		<option value="1">农业户口</option> 
        		<option value="2">城镇户口</option> 
        	</select>
     
          <div class="tips"></div>
        </div>
      </div>
       <div class="form-group">
        <div class="label">
          <label>婚姻状况</label>
        </div>
        
        <div class="field">
        <select name="isMarry" class="input w50">
        		<option value="1">已婚</option> 
        		<option value="2">未婚</option> 
        	</select>
          <div class="tips"></div>
        </div>
      </div>
       <div class="form-group">
        <div class="label">
          <label>工作单位</label>
        </div>
        
        <div class="field">
          <input type="text" class="input w50" value="" id="workAddress"name="workAddress" data-validate="required:请输入工作单位" />
          <div class="tips"></div>
        </div>
      </div>
       <div class="form-group">
        <div class="label">
          <label>联系电话</label>
        </div>
        
        <div class="field">
          <input type="text" class="input w50" value="" name="phoneNumber" data-validate="required:请输入联系电话" />
          <div class="tips"></div>
        </div>
      </div>
      
      
      
      <div class="form-group">
        <div class="label">
          <label></label>
        </div>
        <div class="field">
          <button class="button bg-main icon-check-square-o" type="submit"> 提交</button>
        </div>
        </div>
      </div> 
     
	  
    </form>
  </div>
  
</div>

</body>
</html>